package com.dodo.blog.ui.page;

import com.dodo.blog.RequestCycle;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.Serializable;

/**
 * @author <a href="mailto:pohorelec@comvai.com">Jozef Pohorelec</a>
 */
public abstract class Page
        implements Serializable
{
    private static final long serialVersionUID = 1L;

//    protected Logger log = Logger.getLogger( this.getClass().getName() );

    public String render()
    {
        onRender();
        return getPageContent();
    }

    public abstract String getPageContent();

    public abstract void onRender();

    public HttpServletRequest getRequest()
    {
        return RequestCycle.get().getRequest();
    }

    public HttpServletResponse getResponse()
    {
        return RequestCycle.get().getResponse();
    }

}
